Earth formations, or simply formations, may be used for various purposes such as hydrocarbon production, geothermal production, and carbon dioxide sequestration. In order to make optimal use of a formation, it is typically characterized using a downhole tool that is conveyed through a borehole penetrating the formation.
One type of downhole tool is a nuclear magnetic resonance (NMR) tool that performs NMR measurements on the formation to determine various properties such as porosity for example. In one application referred to as logging-while-drilling, the NMR tool is coupled to a drill string. The NMR tool performs NMR measurements while the drill string is rotating causing a drill bit also coupled to the drill string to drill the borehole. The drill process, however, may cause the drill string to move laterally in the borehole thus continuously varying the distance from the NMR tool to the formation being characterized. Lateral motion of the NMR tool may also occur due to rotation of the tool without drilling. Unfortunately, the continuously varying distance may induce motion artifacts in the obtained NMR data resulting in a decrease in the accuracy of the data.